﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;

using Xc.DataAccess.Core;
using Xc.Logics.HyperTerminalCore.Udp.Models;

namespace Xc.Logics.HyperTerminalCore.Udp.ViewModels
{
    public class TerminalViewModel:ViewModelBase
    {
        ObservableCollection<ChatInfo> chatInfos = new ObservableCollection<ChatInfo>();
        /// <summary>
        /// 聊天信息
        /// </summary>
        public ObservableCollection<ChatInfo> ChatInfos
        {
            get => chatInfos;
            set
            {
                if (chatInfos == value)
                {
                    return;
                }

                chatInfos = value;
                RaisedPropertyChanged();
            }
        }
        string sendText;
        /// <summary>
        /// 要发送的数据
        /// </summary>
        public string SendText
        {
            get => sendText;
            set
            {
                if (sendText == value)
                {
                    return;
                }

                sendText = value;
                RaisedPropertyChanged();
            }
        }
        bool returnSend = true;
        /// <summary>
        /// 回车发送
        /// </summary>
        public bool ReturnSend
        {
            get => returnSend;
            set
            {
                if (returnSend == value)
                {
                    return;
                }

                returnSend = value;
                RaisedPropertyChanged();
                RaisedPropertyChanged(nameof(AcceptReturn));
            }
        }
        public bool AcceptReturn => !ReturnSend;
        ObservableCollection<string> sendLists = new ObservableCollection<string>();
        /// <summary>
        /// 发送列表
        /// </summary>
        public ObservableCollection<string> SendLists
        {
            get => sendLists;
            set
            {
                if (sendLists == value)
                {
                    return;
                }

                sendLists = value;
                RaisedPropertyChanged();
            }
        }
        bool appendLine = true;
        /// <summary>
        /// 添加换行符
        /// </summary>
        public bool AppendLine
        {
            get => appendLine;
            set
            {
                if (appendLine == value)
                {
                    return;
                }

                appendLine = value;
                RaisedPropertyChanged();
            }
        }
    }
}
